package com.itzol.javablog.controller;

import com.itzol.javablog.entity.Category;
import com.itzol.javablog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/add")
public class CategoryController {
    @Autowired
    private CategoryService service;
    //新增文章分类
    @PostMapping("/addclass")
    public boolean addclass(@RequestBody Category category){
        boolean r= service.Addcalss(category);
        if (r) {
            return true;
        }
        else {
            return false;
        }
    }
    //查询新增文章时的所有分类
    @PostMapping("/selectcategory")
    public List<Category> selectcategory(){
        return service.selectcategory();
    }
}
